<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>农产品质量安全追溯系统 - 合作企业</title>
<link rel="stylesheet" href="${path }/cms/css/public.css"/>
<link rel="stylesheet" href="${path }/cms/css/cooperativeEnterprise.css"/>
<script type="text/javascript" src="${path }/cms/js/jquery-1.8.3.min.js"></script>
</head>
<body>
<%@ include file="/WEB-INF/cms/header.jsp" %>

<div class="topHeader">
    <h2>合作企业</h2>
    <p>cooperative enterprise</p>
    <p>以创新的、拥有专利技术的产品为用户提供完善的解决方案和工程实施，</p>
    <p>全程贴心的服务引领农人全面转型全方位致富数据，智能贯彻生产始终。</p>
</div>

<div class="heqyBox" id="qiyelist">
</div>

<div class="pageBox">
    <div class="counter" id="pageCounter"></div>
    <button class="paginate left" id="pagePrev"><i></i><i></i></button>
    <button class="paginate right" id="pageNext"><i></i><i></i></button>
</div>

<%@ include file="/WEB-INF/cms/footer.jsp" %>
<script type="text/javascript">
var pagePrev, pageNext, pageCounter, pageNo=1, pageCount=10000;
$(function(){
	pagePrev = $('#pagePrev');
	pagePrev.click(function(){
		if(pageNo<=1){
			pageNo = 1;
		}else{
			pageNo--;
		}
		loadPage(pageNo);
	});
	pageNext = $('#pageNext');
	pageNext.click(function(){
		if(pageNo>=pageCount){
			pageNo = pageCount;
		}else{
			pageNo++;
		}
		loadPage(pageNo);
	});
	pageCounter = $('#pageCounter');
	loadPage(1);
	
});
function loadPage(pageNo){
	$.get("${path}/c/listQiye.json?page="+pageNo,function(page){
		pageNo = page.pageNo;
		pageCount = page.totalPage;
		pageCounter.html(pageNo+" / "+pageCount);
		pagePrev[0].setAttribute('data-state', pageNo<=1 ? 'disabled' : '');
		pageNext[0].setAttribute('data-state', pageNo>=pageCount ? 'disabled' : '');
		
		var list = page.rows;
		var qiyelist = $('#qiyelist');
		qiyelist.empty();
		$.each(list, function(i, d){
			var str = '<div class="hzqyTop"> ';
			str+='<div class="oneHzqy">';
			str+='<div> <a href="${path}/c/qiyeDetail.do?id='+d.companyid+'"> <img src="'+d.imgurl+'" alt="" onerror="this.src=\'${path}/cms/def/qiye.png\'"/> </a> </div> ';
			str+='<div> ';
			str+='<a href="${path}/c/qiyeDetail.do?id='+d.companyid+'"> <h2>'+d.companyName+'</h2> </a> ';
			str+='<p>'+d.remark+'</p> ';
			str+='</div> ';
			str+='</div> ';
			if(d.farmPark){
				str+='<div class="szImg"> ';
				str+='<div> ';
				str+='<div class="floatTranslate"> ';
				str+='<div> ';
				str+='<h3>'+d.farmPark.parkName+'</h3> ';
				var farmParkremark = d.farmPark.remark||'';
				if(farmParkremark.length>75){
					farmParkremark = farmParkremark.substring(0, 75)+'...';
				}
				str+='<p>'+farmParkremark+'</p> ';
				str+='</div> ';
				str+='</div> ';
				str+='<img src="'+d.farmPark.logoUrl+'" alt="" onerror="this.src=\'${path}/cms/def/park.png\'"/> ';
				str+='</div> ';
				if(d.farmPark.wellProduct1){
					var pdt = d.farmPark.wellProduct1;
					str+='<div> ';
					str+='<div class="floatMh">'+pdt.productName+'</div> ';
					str+='<img src="'+pdt.productImg+'" alt="" onerror="this.src=\'${path}/cms/def/pdt.png\'"/> ';
					str+='</div> ';
				}else{
					str+='<div> <div class="floatMh">暂无产品</div> <img src="${path}/cms/def/pdt.png" alt="" /> </div> ';
				}
				if(d.farmPark.wellProduct2){
					var pdt = d.farmPark.wellProduct2;
					str+='<div> ';
					str+='<div class="floatMh">'+pdt.productName+'</div> ';
					str+='<img src="'+pdt.productImg+'" alt="" onerror="this.src=\'${path}/cms/def/pdt.png\'"/> ';
					str+='</div> ';
				}else{
					str+='<div> <div class="floatMh">暂无产品</div> <img src="${path}/cms/def/pdt.png" alt="" /> </div> ';
				}
				str+='</div> ';
			}
			str+='</div> ';
			qiyelist.append(str);
		});
		
	});
	
}

</script>
</body>
</html>